package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.csg.vap.bean.PTZRegress;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.BeanValidator;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

public class GetPTZRegress extends ProtectedVsCommander{

	@Override
	protected Element executeCommand(VsClient vsClient,
			PropertiesHolder holder, Element root) {
		BeanValidator.validateNotNull(holder, new String[]{"ptzId"});
		
		int ptzId=holder.getIntProperty("ptzId").intValue();
		PTZRegress regress=vsClient.getPTZRegress(ptzId);
		Element enabled=root.addElement("enableRegress");
		enabled.setText(String.valueOf(regress.isEnableRegress()));
		Element regressTime=root.addElement("regressTime");
		regressTime.setText(String.valueOf(regress.getRegressTime()));
		Element presetIndex=root.addElement("presetIndex");
		presetIndex.setText(String.valueOf(regress.getPresetIndex()));
		Element presetName=root.addElement("presetName");
		presetName.setText(regress.getPresetName());
		return root;
	}

}
